%h1= 'Category "' + @cat_name + '"'
%div.span4{:style => "height:100px;width:500px;margin-top:0px;"}
	%table.table.table-condensed.table-striped
		- @needs.each do |need|
			-if !need.deleted
				%tr
					%td=image_tag need.photo.url(:normal), :width =>'80px',:height =>'80px'
					%td
						-if customer_signed_in?
							%h3= link_to need.name,customer_need_path(need.id.to_s)
							%h4= 'Total Needers: '+need.total_needers.to_s
						-else
							-if supplier_signed_in?
								%h3= link_to need.name,supplier_need_path(need.id.to_s)
							-else
								%h3= link_to need.name,need_path(need.id.to_s)
							%h4= 'Total Needers: '+need.total_needers.to_s	
						%td	
							-if customer_signed_in?
								-if !need.is_needer(current_customer)
									=button_to "iNeed" , iNeed_customer_needs_path(:id => need.id), :class =>"btn-large btn-success"
								-else
									=button_to "Un-need" , un_need_customer_needs_path(:need_id => need.id), :class=>"btn-large  btn-danger"
							-else
								-if supplier_signed_in?
									=form_tag new_offer_path,:method => 'get' do
										=hidden_field_tag :need_id,need.id
										=submit_tag 'New Offer',:class => 'btn-success btn-large'
									%td	
										-if (current_supplier.needs.include? need)
											= button_to "UnTrack", untrack_supplier_needs_path(:need_id => need.id),:class => 'btn-danger btn-large'
										-else
											= button_to "Track", track_supplier_needs_path(:need_id => need.id),:class => 'btn-primary btn-large'
	= will_paginate @needs